<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 200px;
            background-color: skyblue;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <button id="alert">alert</button>
    <button id="confirm">confirm</button>
    <button id="prompt">prompt</button>

    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>

    <script>
        let alertBtn = document.getElementById("alert");
        let confirmBtn = document.getElementById("confirm");
        let promptBtn = document.getElementById("prompt");

        alertBtn.onclick = function(){
            alert("我是alert弹窗")
        }

        confirmBtn.onclick = function(){
            let res = confirm("我是confirm弹窗")
            console.log("confirm弹窗的结果:"+res);
        }

        promptBtn.onclick = function(){
            let result = prompt("我是prompt弹窗")
            console.log("prompt弹窗的结果:"+result);
        }

        // 资源加载完成以后
        window.onload = function(){
            console.log("资源加载完成");
        }

        // 可视窗口改变时
        window.onresize = function(){
            console.log("可视窗口改变了");
        }

        // 滚动条位置改变的时候
        window.onscroll = function(){
            console.log("滚动条位置改变了");
            console.log(window.scrollY,window.scrollX); 
        }
    </script>
</body>
</html>